<!DOCTYPE html>
<html>
<head>
    <title>数据管理</title>
    <meta name="keywords" content=""/>
    <meta name="description" content="">
    <include file="public@head"/>
</head>

<body class="body-white" id="top">
    <include file="public@nav"/>
    <div class="container tc-main">
        <div class="wrap">
            {$list_widget|default=''}
        </div>
        <include file="public@footer"/>
    </div>
    <include file="public@scripts"/>
    <script>
        var regexp=/data_ids\[([0-9]+)\]/;
        var data_list=JSON.parse('{:json_encode($data_list);}');
        var selected_ids="{$selected_ids}".split(",");
        $(function(){
            var checkboxs=$("form").find(":checkbox").each(function(index,elem){
                var checkbox=$(elem);
                var id=checkbox.attr("name").match(regexp)[1];
                if(selected_ids.indexOf(id)>=0){
                    checkbox.click();
                }
            });
        });
        function confirm() {
            var selected=$("form").serializeArray();
            var data={
                "id":[],
                "name":[],
                "data":[]
            }
            for(var index in selected){
                var params=selected[index];
                var res=params.name.match(regexp);
                if(!res || res.length<2){
                    continue;
                }
                var id = res[1];
                data.id.push(id);
                for(var i in data_list){
                    if(data_list[i].id===id){
                        data.name.push(data_list[i].name);
                        data.data.push(data_list[i]);
                    }
                }
            }
            return data;
        }
    </script>
</body>

</html>
